package cn.iocoder.yudao.module.trade.delivery.service;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.trade.delivery.dal.dataobject.DeliveryPickUpStoreDO;
import cn.iocoder.yudao.module.trade.delivery.vo.DeliveryPickUpBindReqVO;
import cn.iocoder.yudao.module.trade.delivery.vo.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.delivery.vo.DeliveryPickUpStoreRespVO;
import cn.iocoder.yudao.module.trade.delivery.vo.DeliveryPickUpStoreSaveReqVO;
import jakarta.validation.Valid;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;

/**
 * 自提门店 Service 实现类
 *
 * @author jason
 */
public interface DeliveryPickUpStoreService {

    /**
     * 创建/更新自提门店
     *
     * @param reqVO 更新信息
     * @return 门店编号
     */
    Long saveDeliveryPickUpStore(@Valid DeliveryPickUpStoreSaveReqVO reqVO);

    /**
     * 删除自提门店
     *
     * @param id 编号
     */
    void deleteDeliveryPickUpStore(Long id);

    /**
     * 获得自提门店
     *
     * @param id 编号
     * @return 自提门店
     */
    DeliveryPickUpStoreDO getDeliveryPickUpStore(Long id);

    /**
     * 获得自提门店
     *
     * @param shopId 店铺编号
     * @param name 门店名称
     * @return 自提门店
     */
    DeliveryPickUpStoreDO getDeliveryPickUpStoreByShopName(Long shopId, String name);

    /**
     * 获得自提门店列表
     *
     * @param ids 编号
     * @return 自提门店列表
     */
    List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(Collection<Long> ids);

    /**
     * 获得自提门店 Map
     *
     * @param ids 编号
     * @return 自提门店 Map
     */
    default Map<Long, DeliveryPickUpStoreRespVO> getDeliveryPickUpStoreMap(Collection<Long> ids) {
        List<DeliveryPickUpStoreDO> list = getDeliveryPickUpStoreList(ids);
        List<DeliveryPickUpStoreRespVO> respVOS = BeanUtils.toBean(list, DeliveryPickUpStoreRespVO.class);
        return convertMap(respVOS, DeliveryPickUpStoreRespVO::getId);
    }

    /**
     * 获得指定状态的自提门店列表
     *
     * @param status 状态
     * @return 自提门店列表
     */
    List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status);

    /**
     * 获得自提门店分页
     *
     * @param pageReqVO 分页查询
     * @return 自提门店分页
     */
    PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);

    /**
     * 绑定自提店员
     *
     * @param bindReqVO 绑定数据
     */
    void bindDeliveryPickUpStore(DeliveryPickUpBindReqVO bindReqVO);

}
